package arts.spbu.testswing;

import java.awt.Component;
import javax.swing.*;
/**
 * Created with IntelliJ IDEA.
 * User: pev67021
 * Date: 29.10.12
 * Time: 8:52
 */

public class RegCellRenderer extends DefaultListCellRenderer {

    @Override
    public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
        JLabel l = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
        MatchEntry entry = (MatchEntry) value;
        l.setText("<html><font color=\"blue\">" + entry.getBeg() + "-" + entry.getEnd() + "</font>: " + entry.getEntry() + "</html>");
        return l;
    }
}

